package com.sunshine.bean;

/**
 * @author WeiHong
 * @date 2019/11/20 11:44
 */
public class Person {

    private String name;

    private int age;

    private String address;

    private String mobile;

    private Person(Builder builder) {
        this.name = builder.name;
        this.age = builder.age;
        this.address = builder.address;
        this.mobile = builder.mobile;
    }

    public static Builder newPerson() {
        return new Builder();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }


    public static final class Builder {
        private String name;
        private int age;
        private String address;
        private String mobile;

        private Builder() {
        }

        public Person build() {
            return new Person(this);
        }

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder age(int age) {
            this.age = age;
            return this;
        }

        public Builder address(String address) {
            this.address = address;
            return this;
        }

        public Builder mobile(String mobile) {
            this.mobile = mobile;
            return this;
        }
    }
}
